/**
 * 以下为框架基础模块勿更改！！！
 */
import {NgModule, ErrorHandler} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {IonicApp, IonicModule, IonicErrorHandler} from 'ionic-angular';
import {MyApp} from './app.component';

import {StatusBar} from '@ionic-native/status-bar';
import {SplashScreen} from '@ionic-native/splash-screen';

// Import HttpClientModule from @angular/common/http
import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from '@angular/common/http'
/**
 * 以下为项目基础模块，谨慎修改！
 */
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
import {createTranslateHttpLoader} from "../services/common/i18n.service";

import {AuthService} from "../services/common/auth.service";
import {BackButtonService} from "../services/common/back-button.service";
import {HttpInterceptorService} from "../services/common/http-interceptor.service";
import {LoadingService} from "../services/common/loading.service";
import {Device} from "@ionic-native/device";
import {Network} from "@ionic-native/network";
import {JPush} from '@jiguang-ionic/jpush';

/**
 * 以下为provider
 */
import {DetailProvider} from '../providers/detail/detail';
import {LoginProvider} from '../providers/login/login';
import {JPushService} from "../services/native/j-push.service";


@NgModule({
    declarations: [
        MyApp,
    ],
    imports: [
        BrowserModule,
        // Include it under 'imports' in your application module
        // after BrowserModule.
        HttpClientModule,
        IonicModule.forRoot(MyApp, {
            tabsHideOnSubPages: 'true',
            iconMode: 'ios',
            mode: 'ios',
        }),
        TranslateModule.forRoot({ //语言国际化
            loader: {
                provide: TranslateLoader,
                useFactory: (createTranslateHttpLoader),
                deps: [HttpClient]
            }
        }),
    ],
    bootstrap: [IonicApp],
    entryComponents: [
        MyApp,
    ],
    providers: [
        {
            provide: HTTP_INTERCEPTORS,
            useClass: HttpInterceptorService,
            multi: true,
        },
        AuthService,
        BackButtonService,
        LoadingService,
        Device,
        Network,
        JPush,
        JPushService,
        StatusBar,
        SplashScreen,
        {provide: ErrorHandler, useClass: IonicErrorHandler},
        DetailProvider,
        LoginProvider
    ]
})
export class AppModule {
}
